/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.utility;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

/**
 * Utility that helps with chores with images
 * @author dolphinigle
 */
public class ImageUtility {

  /**
   * Loads image from the given path
   * @param imgpath image path
   * @return the image upon loading
   * @throws Error if Image cannot be loaded
   */
  public static Image loadImage(String imgpath) {
    BufferedImage img = null;

    try {
      img = ImageIO.read(new File(imgpath));
      return img;
    } catch (IOException e) {
      throw new Error("cannot open " + imgpath);
    }
  }
}
